# import requests
#
#
# class HDFS:
#     def __init__(self, hdfs):
#         self.url_path = hdfs + '/webhdfs/v1'
#
#     def list(self, path):
#         response = requests.get(self.url_path + path + '?op=LISTSTATUS')
#         file_obj = response.json()
#         for f in file_obj['FileStatuses']['FileStatus']:
#             print('{}\t{}\t{}'.format(f['owner'], f['group'], f['pathSuffix']))
#
#
# hdfs = HDFS('http://192.168.1.7:50070')
# hdfs.list('/')

import hdfs


h = hdfs.Client('http://192.168.1.7:50070')

# def list(path):
#     for f in h.list(path):
#         print(f)

# write data in file
# h.write('/data/hell.txt', data='this is a test file')
# list('/data')

# read file
# with h.read('/data/hell.txt') as reader:
#     data = reader.read()
#     print(data)


# from snakebite import client
#
# c = client.Client(host='192.168.1.7', port=9000)
# for f in c.ls(['/data']):
#     print(f['path'])